package foo;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class WorkManager {
	private static Object syncLock = new Object();
	private static final Log LOG = LogFactory.getLog(WorkManager.class);
	private final List<Task> tasks = new ArrayList<Task>();

	public void submitTask(final Task newTask) {
		synchronized (syncLock) {
			tasks.add(newTask);
			new Worker(newTask).start();
		}
	}

	public List<Task> getTasks() {
		return tasks;
	}
}
